#ifndef RULES_H
#define RULES_H
#include "fw4.h"
#include <linux/inet.h>
#define NUM_OF_DEF_RULES 4
#define NUM_OF_PROTOCOLS 3
typedef __u8 ipAddress;	
#define LAST_RULE_PROT 255
#define LOCALHOST  in_aton("127.0.0.1")
#define IP_VERSION 4
#define UNMATCHED_PACKET -1
#define MAX_BITS_MASK 32
#define PORT_WILDCARD 0
/*
 * function  checkPermission:
 * checks if the rules allow or deny conversation
 * between specific clientIP and serverIP
 * between specific clientIP and serverIP
 * params		: full rules matrix, clientID, serverID
 * return value : VERDICT_ALLOW - if allowed, VERDICT_DROP - otherwise
 * assumptions  : call is made after a call to LoadRules, 
 * 				  clientID and serverID are at range 0-255   
 */
static char checkPermission(rawPacket_t* packet, int *matchedIndex);


/*
 * 
 */
static void loadDefaultRules(void);

/*
 * function applyMaskToIP
 * applies a given mask to a given ip after ntohl, meaning ip is in computer variant endian
 * params		:  ip, mask (0-32)
 * return value	:  ip after mask is applied
 * assumptions  :  ip is in computer endian format (not network format) and mask is between 0-32
 */
static __u32 applyMaskToIP(__u32 ip, __u8 mask);
#endif

